﻿// Study0402.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
// 第四章 类和对象 构造函数

#include <iostream>
using namespace std;

class clock
{
public:
	clock();
	clock(int newH, int newM, int newS);
	void setTime(int newH, int newM, int newS);
	void showTime();
private:
	int hour, minute, second;
};

clock::clock() : hour(0), minute(0), second(0) {};
clock::clock(int newH, int newM, int newS) :hour(newH), minute(newM), second(newS) {};
void clock::setTime(int newH, int newM, int newS)
{
	hour = newH;
	minute = newM;
	second = newS;
}
void clock::showTime()
{
	cout << hour << ":" << minute << ":" << second << endl;
}



int main()
{
	class clock my_clock1;
	my_clock1.showTime();
	cout << endl;
	class clock my_clock2(8, 10, 10);
	my_clock2.showTime();
	cout << endl;
	my_clock1.setTime(10, 0, 0);
	my_clock1.showTime();
	cout << endl;
	return  0;


}

